<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>客房管理</title>
    <script src="js/app.js"></script>
    <script src="js/holder.js"></script>
    <script src="js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="css/bootstrap.css">

</head>
<body>
<div th:insert="admin/navigate::nav"></div>

<div class="panel panel-default" style="margin-top: -20px;">
    <div class="comtent_1">


        <div class="row">
            <div class="col-sm-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <a href="" class="list-group-item active"  type="button" data-toggle="modal" data-target="#login-modal">
                            <center><strong>客房管理</strong></center>
                        </a>
                    </div>
                    <div class="panel-body">
                        <table class="table table-striped table-hover table-responsive">
                            <thead>
                            <tr>
                                <th>房间号</th>
                                <th>姓名</th>
                                <th>入住状态</th>
                                <th>是否停用</th>
                                <th>入住日期</th>
                                <th>离开日期</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="roomManage :${roomManages}">
                                <th th:text="${roomManage.roomNums}">101</th>
                                <th th:text="${roomManage.username}">王峥</th>
                                <th th:if="${roomManage.checkIn}==1">已入住</th>
                                <th th:if="${roomManage.checkIn}==0">未入住</th>
                                <th th:if="${roomManage.status}==0">否</th>
                                <th th:if="${roomManage.status}==1">是</th>

                                <th th:text="${roomManage.inTime}">2020年5月10日</th>
                                <th th:text="${roomManage.outTime}">2020年5月10日</th>
                                <td>
                                    <form action="/getManageId" method="post">
                                        <button type="submit"  class="btn btn-success" th:value="${roomManage.id}" name="id">修改</button>
                                    </form>

                                    <form action="/banRoom" method="post">
                                        <button type="submit" class="btn btn-danger" th:value="${roomManage.id}" name="id" th:if="${roomManage.status}==1">禁用</button>
                                        <button type="submit" class="btn btn-primary" th:value="${roomManage.id}" name="id" th:if="${roomManage.status}==0">启用</button>
                                    </form>
                                    <form action="/delectRoom" method="post">
                                        <button type="submit" class="btn-danger btn" th:value="${roomManage.id}" name="id">删除</button>
                                    </form>
                                </td>
                            </tr>

                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>

</div>

<div class="modal fade" id="login-modal" tabindex="-1" data-remote="room_modefy.html">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button class="close" data-dismiss="modal">&times;</button>
                <h4>客房信息添加</h4>
            </div>
            <div class="container-fluid">
                <div class="row">
                    <div class="col-xs-6 col-sm-6 col-md-6 col-lg-offset-2 col-xs-offset-2 col-lg-offset-2">
                        <div class="modal-body">

                            <form action="/roomAdd" method="post">
                                <div class="form-group">
                                    <label for="number">房间号</label>
                                    <input type="number" class="form-control" id="number" placeholder="输入房间号"  name="roomNum">
                                </div>

                                <div class="form-group">
                                    <label >是否停用</label>
                                    <select name="status">
                                        <option value="1">否</option>
                                        <option value="0">是</option>
                                    </select>
                                </div>
                                <div class="modal-footer">
                                    <button type="submit" class="btn btn-primary">确定</button>
                                </div>
                            </form>
                        </div>

                    </div>

                </div>
            </div>



        </div>
    </div>
</div>
<script>
    $(function() {
        $('#login-modal').modal({
            show: false,
            backdrop: false,
            remote: 'XiuGai.html'
        });
    });

</script>


</body>
</html>